package com.rick.new202232;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * @author xjli2
 * @Classname TestOOM
 * @Description TODO
 * @Date 2022/3/2 10:01
 */
public class TestOOM {
   final static List<ByteArray> bytes = new ArrayList<>();

    public static void main(String[] args) {


        try {
            for (; ; ) {
                ByteArray byteArray = new ByteArray();
//                bytes.add(byteArray);
                System.out.println("测试OOM bytes = " + bytes);
                TimeUnit.SECONDS.sleep(3);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    static class ByteArray {
        byte[] bytes = new byte[1024 * 1024];
    }
}
